﻿
// BresenHamView.h: CBresenHamView 类的接口
//

#pragma once
#include "CPoint2D.h"


class CBresenHamView : public CView
{
protected: // 仅从序列化创建
	CBresenHamView() noexcept;
	DECLARE_DYNCREATE(CBresenHamView)

// 特性
public:
	CBresenHamDoc* GetDocument() const;

// 操作
public:
	void DrawPoint(CDC* pDC, CPoint2D& point);
	void DrawLine(CDC* pDC, CPoint2D p0, CPoint2D p1);
	void DrawLineSlopeMoreThanPosi1(CDC* pDC, float slope, CPoint2D& p0, CPoint2D& p1);
	void DrawLineSlopeBetween0ToPosi1(CDC* pDC, float slope, CPoint2D& p0, CPoint2D& p1);
	void DrawLineSlopeBetweenNagt1To0(CDC* pDC, float slope, CPoint2D& p0, CPoint2D& p1);
	void DrawLineSlopeLessThanNagt1(CDC* pDC, float slope, CPoint2D& p0, CPoint2D& p1);


	void CalRGB(int x, int xDist, CRGB& color0, CRGB& color1, CRGB& currColor);

// 重写
public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

// 实现
public:
	virtual ~CBresenHamView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	CPoint2D points[3];
	int numOfPoints;

// 生成的消息映射函数
protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//	afx_msg void OnMove(int x, int y);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
};

#ifndef _DEBUG  // BresenHamView.cpp 中的调试版本
inline CBresenHamDoc* CBresenHamView::GetDocument() const
   { return reinterpret_cast<CBresenHamDoc*>(m_pDocument); }
#endif

